﻿/// <reference path="jquery-1.2.6.min.js" />

$(document).ready(function() {
//sets a timer at 60 seconds to send a request.
    $.timer(60000, function(timer) {
        keepAlive.keepMeAlive(KeepAlive); // sends information async to keep the session alive
    });
});
///<summary>
/// recieves information back about the session.
///</summary>
///<param name="results" optional="false">string[] of results [0] is working [2] is username [3] is URL.</param>
function KeepAlive(results) {
    if (results[0] != '0') {//checks if it worked.
        if (results[0] == '2' & results[3] != null) { //if the user is logged in and I got a url.
            keepAlive.keepMeAlive(KeepAlive); //resend the request.
        }
        document.getElementById("ctl00_lblUsersOnline").innerHTML = results[1]; // submits the result.
        if (results[2] != null & results[2] != '') {
            commonPopup(results[3] + '/IM/chat.aspx?r=' + results[2], 400, 350, 4, 'Chat' + results[2]); //sends the popup request if it came back successful.
        }
    }
};